{% extends "base.html" %}

{% block head-title %}{{algorithm.algorithm_name}}{% endblock %}

{% block title %}{{algorithm.algorithm_name}}{% endblock %}

{% block content %}
<div style="float: right;">
	<a href="/show_source_code?instance_id={{algorithm.instance_id}}"
		class="uk-button uk-button-primary" target="_blank">源代码</a>
</div>

{% ifequal algorithm.algorithm_name "中文分词" %}
<article class="uk-article">
    <h2>原始文本</h2>
    {{algorithm.text}}
    <hr class="uk-article-divider">
</article>

<article class="uk-article">
    <h2>分词</h2>
    {% for seg in algorithm.seg_list %}
		<span class="uk-badge" style="font-size:13px;line-height:18px;">{{ seg }}</span> 
	{% endfor %}
    <hr class="uk-article-divider">
</article>

<article class="uk-article">
    <h2>词性标注 <a href="/static/pdf/词性标注说明.pdf"
			class="uk-button uk-button-mini" target="_blank">词性标注说明文件</a></h2>
    {% for word in algorithm.words %}
    	{% if "n" in word or "ns" in word or "nt" in word or "nr" in word or "nz" in word %}
    		<span class="uk-badge" style="font-size:13px;line-height:18px;background:#5cb85c">{{ word }}</span>
    	{% else %}
    		{% if "v" in word %}
    		<span class="uk-badge" style="font-size:13px;line-height:18px;background:#f0ad4e">{{ word }}</span> 
    		{% else %}
    		<span class="uk-badge" style="font-size:13px;line-height:18px;background:#777">{{ word }}</span>
    		{% endif %}
    	{% endif %} 
	{% endfor %}
    <hr class="uk-article-divider">
</article>

<h2>TextRank关键词</h2>
<table class="uk-table uk-table-striped">
	<thead>
		<tr>
			<th>序号</th>
			<th>关键词</th> 
			<th>权重</th>
		</tr>
	</thead>
	<tbody>
		{% for key_word in algorithm.key_words %}
		<tr>
			<td>{{ forloop.counter }}</td>
			<td>{{ key_word.0 }}</td>
			<td>{{ key_word.1 }}</td>
		</tr>
		{% endfor %}
	</tbody>
</table>

<h2>词云</h2>
<div style="text-align:center;">
	<a href="/static/{{algorithm.instance_id}}/word_cloud.jpg" target="_blank" title="点击查看大图">
						<img src="/static/{{algorithm.instance_id}}/word_cloud.jpg" style="height:300px;">
					</a>
</div>
{% endifequal %}

{% ifequal algorithm.algorithm_name "文本相似度" %}
<article class="uk-article">
    <h2>文本1</h2>
    {{algorithm.text_1}}
    <hr class="uk-article-divider">
</article>

<article class="uk-article">
    <h2>文本2</h2>
    {{algorithm.text_2}}
    <hr class="uk-article-divider">
</article>

<article class="uk-article">
    <h2>文本3</h2>
    {{algorithm.text_3}}
    <hr class="uk-article-divider">
</article>

<h2>相似度</h2>
<table class="uk-table uk-table-striped">
	<thead>
		<tr>
			<th>文本序号</th>
			<th>文本序号</th> 
			<th>相似度</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>1</td>
			<td>2</td>
			<td>{{ algorithm.similarities.0.1 }}</td>
		</tr>
		<tr>
			<td>1</td>
			<td>3</td>
			<td>{{ algorithm.similarities.0.2 }}</td>
		</tr>
		<tr>
			<td>2</td>
			<td>3</td>
			<td>{{ algorithm.similarities.1.2 }}</td>
		</tr>
	</tbody>
</table>

{% endifequal %}

{% endblock %}